<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <title>智冠信息</title>
    <link rel="stylesheet" type="text/css" href="../css/mui.min.css"/>
    <link rel="stylesheet" type="text/css" href="../css/mui.picker.min.css" />
    <link rel="stylesheet" type="text/css" href="../css/use-feedback.css"/>
    <script src="../js/mui.min.js"></script>
    <script src="../js/jquery.min.js"></script>
    <script src="../js/jquery.flexText.min.js"></script>
    <script src="../js/vue.js"></script>
    <script src="../js/main.js"></script>
</head>
<body>
        <div class="main" id="app">
            <div class="feedback-header mui-bar mui-bar-nav">
                <div class="feedback-header-title">用户反馈</div>
            </div>
            <div class="modal">
                <div class="feedback-modal-title modal-title">选择反馈对象</div>
                <div class="feedback-modal-content">
                    <ul>
                        <li>头条</li>
                        <li>对话</li>
                        <li>通知</li>
                        <li>通讯录</li>
                        <li>日程</li>
                        <li>汇报</li>
                        <li>会议</li>
                        <li>审批</li>
                        <li>公告</li>
                        <li>订餐</li>
                        <li>开</li>
                        <li>其他</li>
                    </ul>
                </div>
                <div class="feedback-modal-move">加载更多</div>
            </div>
            <div class="modal">
                <div class="discript-modal-title modal-title">详细描述问题内容</div>
                <div class="discript-modal-content">
                    <div class="discript-modal-textarea">
                        <textarea placeholder="请描述智信遇到的问题及改进期望"></textarea>
                    </div>
                </div>

            </div>
        </div>
</body>
<script src="../js/mui.picker.min.js"></script>
<script>
    var companyChangeId ;
    //在android代码中调用此方法
    function showInfoFromJava(msg){
//        localStorage.fullName = msg;
        companyChangeId = msg;
    }

    $(function () {
        $('textarea').flexText();
    });

    function UrlSearch(){
        var name,value;
        var str=location.href; //取得整个地址栏
        var num=str.indexOf("?");
        str=str.substr(num+1); //取得所有参数   stringvar.substr(start [, length ]

        var arr=str.split("&"); //各个参数放到数组里
        for(var i=0;i < arr.length;i++){
            num=arr[i].indexOf("=");
            if(num>0){
                name=arr[i].substring(0,num);
                value=arr[i].substr(num+1);
                this[name]=value;
            }
        }
    }
    var Request=new UrlSearch(); //实例化
        companyChangeId = Request.cid;
        if(companyChangeId == undefined || companyChangeId == null){companyChangeId = 6}

        var app = new Vue({
            el: "#app",
            data: function () {
                return {
                    receiveUser:Request.loginName,
                    companyId:companyChangeId,
                    beginTime:this.getNow(),
                    total:0,
                    wtotal:0,
                    deadlineTime:[],
                    createUser:"",
                    vcreateUser:Request.loginName,
                    createUserName:"",
                    calenderLengthActive:0,
                    progress:[],
                    hotWords: []
                }
            },
            filters: {
               /* getTime: function(input) {
                    var str = input.slice(-8,-3);
                    return str;
                },
                getHours: function(input) {
                    var str = input.slice(-8,-6);
                    return str;
                }*/
            },
            methods: {
               /* getNow: function() {
                    var d = new Date();
                    var year = d.getFullYear();
                    var month = d.getMonth() + 1;
                    var day = d.getDate() <10 ? '0' + d.getDate() : '' + d.getDate();
                    var hour = d.getHours();
                    var minutes = d.getMinutes();
                    var seconds = d.getSeconds();
                    return year+ '-' + month + '-' + day ;
                },
                ready: function () {
                    var this_obj=this;
                    var url = "/schedule/zgSchedules/index";
                    var data = {
                        "receiveUser":this_obj.receiveUser,
                        "companyId":this_obj.companyId,
                        "beginTime":this_obj.getNow()
                    };
                    console.log(data);
                    if(typeof(this_obj.companyId) == "undefined" || typeof(this_obj.receiveUser) == "undefined"){
                        mui.toast("请重新登录");
                    }else {
                        common_ajax(url, data, function (res) {
                            console.log(res);
                            this_obj.wtotal = res.obj.wtotal;
                            this_obj.total = res.obj.total;
                            this_obj.deadlineTime = [];
                            console.log(res.obj.data);
                            var time;
                            if (res.obj.data.length > 3) {
                                for (var i = 0; i < 3; i++) {
                                    time = parseFloat(res.obj.data[i]['deadlineTime'].slice(-8, -6)) >= 12 ? 'PM' : 'AM';
                                    this_obj.deadlineTime.push({
                                        date: res.obj.data[i]['deadlineTime'],
                                        message: res.obj.data[i]['message'],
                                        createUser: res.obj.data[i]['createUser'],
                                        createUserName: res.obj.data[i]['createUserName'],
                                        time: time,
                                        title: res.obj.data[i]['title']
                                    });
                                }
                            } else {
                                for (var i in res.obj.data) {
                                    time = parseFloat(res.obj.data[i]['deadlineTime'].slice(-8, -6)) >= 12 ? 'PM' : 'AM';
                                    this_obj.deadlineTime.push({
                                        date: res.obj.data[i]['deadlineTime'],
                                        message: res.obj.data[i]['message'],
                                        createUser: res.obj.data[i]['createUser'],
                                        createUserName: res.obj.data[i]['createUserName'],
                                        time: time,
                                        title: res.obj.data[i]['title']
                                    });
                                }
                            }
                            console.log(this_obj.deadlineTime);
                            this_obj.calenderLengthActive = parseFloat(res.obj.wtotal) / parseFloat(res.obj.total) * 100;
                            //                    alert("请求成功");
                        }, function (res) {
                            console.log(res);
                            //                    alert("请求失败");
                        });
                    }

                    var word_url = "/analysis/hotWord";
                    var word_data = {};
                    common_ajax(word_url,word_data,function (res) {
                        if(res.code < 0){
                            mui.toast(res.errorMsg);
                        }else {
                            console.log(res);
                            for(var i in res.obj){
                                var words = [];
                                for(var j in res.obj[i].hotWord){
                                    words.push({name: res.obj[i].hotWord[j]['name']});
                                }
                                this_obj.hotWords.push({date: res.obj[i]['date'],words: words});
                            }
                        }
                    },function (res) {
                        console.log("传输错误");
                    });

                    var pro_url = "/analysis/wordCount";
                    var pro_data = {};
                    common_ajax(pro_url,pro_data,function (res) {
                        if(res.code < 0){
                            mui.toast(res.errorMsg);
                        }else {
                            this_obj.progress = [];
                            for(var i in res.obj){
                                var progress = parseFloat(res.obj[i]['number']/res.obj[i]['total']*100).toFixed(2);
                                this_obj.progress.push({id: res.obj[i]['id'],name: res.obj[i]['name'],number: res.obj[i]['number'],progress: progress});
                            }
                        }
                    },function (res) {
                        console.log(res);
                    });
                }*/
            }
        });
        app.ready();


</script>
</html>